package com.gzj.springboot.tools;

import java.util.Random;

public class Data_Processing {
    /**
     * 获得一组62位的字符串
     * @return
     */
    public String RandomCharacters(){
        String str = "abcdefghijklmnopqrstuvwsyzABCDEFGHIJKLMNOPQRSTUVWSYZ0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        //要控制其长度在length（）后面减就行
        for (int i= 0;i<str.length()-30;i++) {
            //62代表返回的数62种数据都有，，不懂将其换为1
            int number = random.nextInt(62);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }

    /**
     * 返回随机数字
     * @return
     */
    public int RandomNumber(){
        //*10代表0—9随机数 *100代表0-99随机数 +1代表0-100随机数以此类推
        int radom = (int) (Math.random()*1000000+1);
        return radom;
    }
}
